using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.CompositeWeb;
using Microsoft.Practices.CompositeWeb.Interfaces;
using Microsoft.Practices.CompositeWeb.Services;
using Microsoft.Practices.CompositeWeb.Configuration;
using Microsoft.Practices.CompositeWeb.EnterpriseLibrary.Services;
using DataAccess.Services;

namespace DataAccess
{
    public class DataAccessModuleInitializer : ModuleInitializer
    {
        public override void Load(CompositionContainer container)
        {
            base.Load(container);

            AddGlobalServices(container.Services);
            container.RootContainer.RegisterTypeMapping<IUnitOfWork, SqlUnitOfWork>();
            container.RootContainer.RegisterTypeMapping<IDomainContext, LcboDrinkLocatorContext>();
            container.RootContainer.RegisterTypeMapping<IFastDomainContext, LcboDrinkLocatorContextNoChangeTracking>();
        }

        protected virtual void AddGlobalServices(IServiceCollection globalServices)
        {
            //globalServices.AddNew<SqlUnitOfWork, IUnitOfWork>();
            //globalServices.AddNew<LcboDrinkLocatorContext, IDomainContext>();
        }

        public override void Configure(IServiceCollection services, System.Configuration.Configuration moduleConfiguration)
        {
        }
    }
}
